package hxy.bytecode.jdk;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @author eric
 * @date 2021/4/15
 * @link https://www.cnblogs.com/zhuyeshen/p/10956822.html
 * @description 这个确实有意义，需要好好研究下。
 */
public class ConcurrentModificationExceptionTest {

    public void test() {
        String name = ConcurrentModificationExceptionTest.this.getClass().getName();
        System.out.println(name);
    }


    public static void main(String[] args) {


        ArrayList<Integer> list = new ArrayList<Integer>();
        list.add(2);
        Iterator<Integer> iterator = list.iterator();
        while (iterator.hasNext()) {
            Integer integer = iterator.next();
            if (integer == 2) {
                list.remove(integer);
            }
        }


    }
}
